package com.itheima.define;

public class ArrayDemo2 {
    public static void main(String[] args) {
        //数组的访问
        int[] arr = {1,2,3};
        //访问数组里面的元素
        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);

        //修改数组里面的元素
        arr[0] = 10;
        System.out.println(arr[0]);
        arr[1] = 20;
        System.out.println(arr[1]);
        arr[2] = 30;
        System.out.println(arr[2]);

        //数组的长度
        System.out.println(arr.length);

        //获取数组的最大索引
        System.out.println(arr.length - 1); //前提是数组不为空
    }
}
